package com.zhuiyun.project.api.system.user.service;

import com.zhuiyun.project.api.monitor.domain.server.Sys;
import com.zhuiyun.project.api.system.role.entity.SysRole;
import com.zhuiyun.project.api.system.user.entity.SysUser;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.utils.pageUtil.PageRequest;
import com.zhuiyun.project.utils.pageUtil.PageResult;

import java.util.List;

public interface SysUserService {
    /**
     * @Author hyp
     * @Description 用户详情分页查询
     * @Date 2023/10/30 9:21
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param pageRequest
     * @param user
     */
    PageResult listUsers(PageRequest pageRequest, SysUser user);

    /**
     * @Author hyp
     * @Description 添加用户
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int addUser(SysUser user);

    /**
     * @Author hyp
     * @Description 根据用户编号获取详情信息
     * @Date 2023/10/30 9:27
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param id
     */
    SysUser selectUserById(Integer id);

    /**
     * @Author hyp
     * @Description 根据用户编号删除用户
     * @Date 2023/10/30 9:31
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param userids
     */
    CommonResult removeUserByIds(Integer[] userids);

    /**
      * @Author hyp
      * @Description 校验权限
      * @Date 2023/10/30 19:00
      * @Return void
      * @param user
    */
    void checkUserAllowed(SysUser user);

    /**
     * @Author hyp
     * @Description 修改用户
     * @Date 2023/10/30 9:31
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int editUser(SysUser user);

    /**
     * @Author hyp
     * @Description 修改用户状态
     * @Date 2023/10/30 9:33
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int changeStatusUser(SysUser user);

    /**
     * @Author hyp
     * @Description 校验用户名唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    boolean checkLoginNameUnique(SysUser user);

    /**
     * @Author hyp
     * @Description 校验手机号唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    boolean checkPhoneUnique(SysUser user);

    /**
     * @Author hyp
     * @Description 校验用户名唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    boolean checkEmailUnique(SysUser user);

    /**
      * @Author hyp
      * @Description 获得当前登录用户所拥有的角色
      * @Date 2023/10/30 19:06
      * @Return java.lang.String
      * @param loginName
    */
    String selectUserRoleGroup(String loginName);

    /**
     * @Author hyp
     * @Description 修改个人基本信息
     * @Date 2023/10/30 9:42
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int updateProfile(SysUser user);

    /**
     * @Author hyp
     * @Description 修改密码
     * @Date 2023/10/30 9:44
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param userId
     * @param encryptPassword
     */
    int resetUserPwd(Integer userId, String encryptPassword);

    /**
     * @Author hyp
     * @Description  修改用户头像
     * @Date 2023/10/30 13:42
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param avatarId
     * @param id
     */
    int updateAvatarId(String avatarId, Integer id);

    /**
      * @Author hyp
      * @Description 根据手机号查询用户信息
      * @Date 2023/10/30 19:44
      * @Return com.zhuiyun.project.api.system.user.entity.SysUser
      * @param phoneAccount
    */
    SysUser getUserByPhoneAccount(String phoneAccount);

    /**
      * @Author hyp
      * @Description 根据邮箱查询用户信息
      * @Date 2023/10/30 19:45
      * @Return com.zhuiyun.project.api.system.user.entity.SysUser
      * @param emailAccount
    */
    SysUser getUserByEmailAccount(String emailAccount);

    /**
      * @Author hyp
      * @Description 根据登录名查询用户信息
      * @Date 2023/10/30 19:51
      * @Return com.zhuiyun.project.api.system.user.entity.SysUser
      * @param username
    */
    SysUser getUserByLoginName(String username);

    /**
      * @Author hyp
      * @Description 修改用户状态
      * @Date 2023/10/30 19:58
      * @Return void
      * @param sysUser
    */
    void updateUserByLogin(SysUser sysUser);
    /**
     * @Author hyp
     * @Description 查询已分配用户角色列表
     * @Date 2023/10/26 14:33
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param pageRequest
     * @param user
     */
    PageResult selectAllocatedList(PageRequest pageRequest, SysUser user);
    /**
     * @Author hyp
     * @Description 查询未分配用户角色列表
     * @Date 2023/10/26 14:33
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param pageRequest
     * @param user
     */
    PageResult selectUnallocatedList(PageRequest pageRequest, SysUser user);


    /**
     * @Author hyp
     * @Description 用户分配角色
     * @Date 2023/11/3 8:26
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param userId
     * @param roleIds
     */
    int addAuthRole(Integer userId, Long[] roleIds);
    /**
     * @Author hyp
     * @Description 重置密码
     * @Date 2023/11/3 8:26
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int resetPwd(SysUser user);
}
